package com.otheima.localdatetime;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Month;

public class Test {//LocalDateTime演示
    public static void main(String[] args) {
        LocalDateTime dateTime1 = LocalDateTime.now();
        LocalDateTime dateTime2 = LocalDateTime.of(2021,8,05,11,11,11);
        System.out.println(dateTime2);
        System.out.println(dateTime1);

        int year = dateTime1.getYear();
        Month month = dateTime1.getMonth();
        int monthValue = dateTime1.getMonthValue();
        int dayOfMonth = dateTime1.getDayOfMonth();
        int hour = dateTime1.getHour();
        int minute = dateTime1.getMinute();
        int second = dateTime1.getSecond();
        DayOfWeek dayOfWeek = dateTime1.getDayOfWeek();
        int value = dayOfWeek.getValue();

        System.out.println("现在是"+year+"年"+monthValue+"月"+dayOfMonth+"日"+"  "+"星期"+value+"  "+hour+"时"+minute+"分"+second+"秒");
    }
}
